package com.jrzh.mvc.convert.sys;

import com.jrzh.framework.base.convert.BaseConvertI;
import com.jrzh.common.exception.ProjectException;
import com.jrzh.mvc.model.sys.FileRuleModel;
import com.jrzh.mvc.view.sys.FileRuleView;
import com.jrzh.common.utils.ReflectUtils;

public class FileRuleConvert implements BaseConvertI<FileRuleModel, FileRuleView> {

	@Override
	public FileRuleModel addConvert(FileRuleView view) throws ProjectException {
		FileRuleModel model = new FileRuleModel();
		ReflectUtils.copySameFieldToTarget(view, model);
		return model;
	}

	@Override
	public FileRuleModel editConvert(FileRuleView view, FileRuleModel model) throws ProjectException {
		ReflectUtils.copySameFieldToTargetFilter(view, model, new String[]{"createBy", "createTime"});
		return model;
	}

	@Override
	public FileRuleView convertToView(FileRuleModel model) throws ProjectException {
		FileRuleView view = new FileRuleView();
		ReflectUtils.copySameFieldToTarget(model, view);
		return view;
	}

}
